/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.client.view.user;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import org.lucava.boatskeeper.client.presenter.user.UserAuthPresenter;

/**
 *
 * @author glenn
 */
public class UserAuthView extends DialogBox implements UserAuthPresenter.Display {

    private final Button connectButton;
    private final TextBox userid;
    private final PasswordTextBox passwd;
    private final Label message;

    public UserAuthView() {

        VerticalPanel holder = new VerticalPanel();

        holder.add(new Label("User ID"));
        userid = new TextBox();
        userid.setName("userid");
        holder.add(userid);

        holder.add(new Label("Password"));
        passwd = new PasswordTextBox();
        passwd.setName("passwd");
        holder.add(passwd);

        connectButton = new Button("Connexion");
        holder.add(connectButton);

        //error message
        message = new Label();
        holder.add(message);

        setWidget(holder);


    }

    @Override
    public HasClickHandlers getConnectButton() {
        return this.connectButton;
    }

    @Override
    public HasValue<String> getLogin() {
        return this.userid;
    }

    @Override
    public HasValue<String> getPassword() {
        return this.passwd;
    }

    @Override
    public void startProcessing() {
    }

    @Override
    public void stopProcessing() {
    }

    @Override
    public void setMessage(String message) {
        this.message.setText(message);
    }
}
